home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / bsrc_250.zip / SBUF.H < prev    next >
C/C++ Source or Header  |  1991-09-15  |  8KB  |  198 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*             Screen Buffer Definitions used in BinkleyTerm                */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.250.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  24. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  25. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  26. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  27. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /* You can contact Bit Bucket Software Co. at any one of the following      */
  31. /* addresses:                                                               */
  32. /*                                                                          */
  33. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  34. /* P.O. Box 460398                AlterNet 7:491/0                          */
  35. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  36. /*                                Internet f491.n343.z1.fidonet.org         */
  37. /*                                                                          */
  38. /* Please feel free to contact us at any time to share your comments about  */
  39. /* our software and/or licensing policies.                                  */
  40. /*                                                                          */
  41. /*--------------------------------------------------------------------------*/
  42.  
  43.  
  44. #define SB_OK  0
  45. #define SB_ERR (-1)
  46.  
  47. #define SB_MODE_ANSI 1
  48. #define SB_MODE_AVATAR 2
  49. #define SB_MODE_SIMPLE 0
  50.  
  51. /* screen buffer constants */
  52. extern unsigned int SB_ROWS;
  53. extern unsigned int SB_COLS;
  54.  
  55. #define SB_SIZ  SB_ROWS * SB_COLS
  56.  
  57. typedef struct {
  58.   unsigned int          Attr;          /* Note, this is NOT the same as a */
  59.                                        /* Windows attr word               */
  60.   int                   Bgd;
  61.   unsigned char         Buf[81];
  62.   int                   CtrlSeqIntro;
  63.   int                   Esc;
  64.   int                   Fgd;
  65.   int                   NewLineKludge;
  66.   int                   Mode;          /* Simple, ANSI, or Avatar */
  67.   unsigned int          SaveCol;
  68.   unsigned int          SaveRow;
  69.   int                   Scroll;
  70.   int                   State;         /* Maybe run it like an FSM */
  71.   } _ANSIStuff, *_ANSIStuffP;
  72.  
  73.  
  74. /* screen character/attribute buffer element definition */
  75. typedef struct
  76. {
  77.    unsigned char ch;                             /* character */
  78.    unsigned char attr;                           /* attribute */
  79. } BYTEBUF, *BYTEBUFP;
  80.  
  81. typedef union
  82. {
  83.    BYTEBUF b;
  84.    unsigned int cap;                             /* character/attribute pair */
  85. } CELL, *CELLP;
  86.  
  87. /* screen buffer control structure */
  88. typedef struct
  89. {
  90.    /* current position */
  91.    int row, col;
  92.  
  93.    /* pointer to screen buffer array */
  94.    CELLP bp;
  95.  
  96.    /* changed region per screen buffer row */
  97.    int *lcol;                                    /* left end of changed
  98.                                                   * region */
  99.    int *rcol;                                    /* right end of changed
  100.                                                   * region */
  101.  
  102.    /* buffer status */
  103.    unsigned int flags;
  104. } BUFFER, *BUFFERP;
  105.  
  106. /* buffer flags values */
  107. #define SB_DELTA  0x01
  108. #define SB_RAW    0x02
  109. #define SB_DIRECT 0x04
  110. #define SB_SCROLL 0x08
  111. #define SB_SYNC   0x10
  112.  
  113. #ifdef MILQ
  114.  
  115. #define MILQ_WIN_CLOSED 0x0001
  116. #define MILQ_WIN_FOCUS  0x0002
  117.  
  118. typedef struct {
  119.   RECT                  OrgRect;
  120.   int                   OrgZ;          /* We are not currently saving the */
  121.                                        /* Z ordering.  We want to.        */
  122.   int                   Flags;         /* Does the window have the focus? */
  123.                                        /* Is the window even open?        */
  124.   } _MilqSave;
  125.  
  126. #endif
  127.  
  128. /* coordinates of a window (rectangular region) on the screen buffer */
  129.  
  130. /* At one point, we tried substituting REGION with HWND.  There were some
  131.  * inherent problems with this, most notably, that a window doesn't have
  132.  * a current cursor position concept.
  133.  *
  134.  * We probably can and should create a special window class that would
  135.  * deal with this, but not today...
  136.  */
  137.  
  138. typedef struct
  139. {
  140.    /* current position */
  141.    int row, col;
  142.  
  143.    /* window boundaries */
  144.    int r0, c0;                                   /* upper left corner */
  145.    int r1, c1;                                   /* lower right corner */
  146.  
  147.    /* scrolling region boundaries */
  148.    int sr0, sc0;                                 /* upper left corner */
  149.    int sr1, sc1;                                 /* lower right corner */
  150.  
  151.    /* window buffer flags */
  152.    unsigned int wflags;
  153.  
  154.    _ANSIStuff           ANSI;
  155.  
  156. #ifdef MILQ
  157.    HWND                 hWnd;
  158.    _MilqSave            MilqSave;
  159. #endif
  160.  
  161. } REGION, *REGIONP;
  162.  
  163. /* coordinates of a window (rectangular region) on the screen buffer */
  164. typedef struct {
  165.    /* top left corner */
  166.    short save_row, save_col;
  167.  
  168.    /* height and width */
  169.    short save_ht, save_wid;
  170.  
  171.    /* Window to use */
  172.    REGIONP region;
  173.  
  174.    /* Saved cells from the window */
  175.    CELLP save_cells;
  176.  
  177. } BINK_SAVE, *BINK_SAVEP;
  178.  
  179. #define HIST_BBS_ROW  1
  180. #define HIST_MAIL_ROW 1
  181. #define HIST_ATT_ROW  2
  182. #define HIST_CONN_ROW 3
  183. #define HIST_FILE_ROW 4
  184. #define HIST_LAST_ROW 5
  185. #define HIST_COL      13
  186. #define HIST_COL2     8
  187.  
  188. #define SET_EVNT_ROW  2
  189. #define SET_PORT_ROW  3
  190. #define SET_TIME_ROW  1
  191. #define SET_DATE_ROW  4
  192. #define SET_STAT_ROW  4
  193. #define SET_TASK_ROW  5
  194.  
  195. #define SET_COL       10
  196. #define SET_TIME_COL  2
  197.  
  198.